import http from "@/utils/http/hub";
/**
 * 我的钱包
 */
export const getWallet = (
  params,
  config = {
    custom: {
      auth: true,
    },
  }
) => {
  return http.get({
    url: `/wallet/index`,
    params,
    config,
  });
};

/**
 * 变动明细列表
 */
export const getList = (
  params,
  config = {
    custom: {
      auth: true,
    },
  }
) => {
  return http.get({
    url: `/wallet/getList`,
    params,
    config,
  });
  // return new Promise((resolve, reject) => {
  //   resolve({
  //     code: 10000,
  //     msg: "success",
  //     data: {
  //       data: null,
  //       list: [
  //         {
  //           workerWithdrawId: 2, //钱包变动id
  //           title: "订单收益1", //标题
  //           localNo: "123123", //订单号
  //           price: "186.00", //金额
  //           priceType: 1, //金额类型1=增加2=减少
  //           type: 1, //类型1=订单收益2=提现到银行卡3=保证金
  //           status: 2, //状态0=待审核1=通过(银行处理中)2=到账3=失败
  //           createdAt: "2025-01-10 10:08:50", //时间
  //           underCreateDate: "2025-01", //年月
  //           index: 0, //0=需要显示underCreateDate和withdrawPrice和distributionPrice=1不显示
  //           withdrawPrice: "197.00", //总提现金额
  //           distributionPrice: "372.00", //总收入金额
  //         },
  //         {
  //           workerWithdrawId: 3, //钱包变动id
  //           title: "订单收益", //标题
  //           localNo: "123123", //订单号
  //           price: "111.00", //金额
  //           priceType: 2, //金额类型1=增加2=减少
  //           type: 1, //类型1=订单收益2=提现到银行卡3=保证金
  //           status: 1, //状态0=待审核1=通过(银行处理中)2=到账3=失败
  //           createdAt: "2025-01-10 10:08:50", //时间
  //           underCreateDate: "2025-01", //年月
  //           index: 1, //0=需要显示underCreateDate和withdrawPrice和distributionPrice=1不显示
  //           withdrawPrice: "197.00", //总提现金额
  //           distributionPrice: "372.00", //总收入金额
  //         },
  //       ],
  //       count: 5,
  //       pages: 1,
  //       current: 1,
  //       size: 20,
  //     },
  //   });
  // });
};

/**
 * 变动明细详情
 * userWithdrawId 变动明细id
 */
export const withdrawDetail = (
  params,
  config = {
    custom: {
      auth: true,
    },
  }
) => {
  return http.post({
    url: `/wallet/withdrawDetail`,
    params,
    config,
  });
  // return new Promise((resolve, reject) => {
  //   resolve({
  //     code: 10000,
  //     msg: "success",
  //     data: {
  //       workerWithdrawId: 2, //钱包变动id
  //       title: "订单收益", //标题
  //       localNo: "S3447665091759594", //订单号
  //       price: "186.00", //申请提现金额或订单收益金额
  //       serviceCharge: "0.00", //手续费
  //       priceType: 1, //金额类型1=增加2=减少
  //       type: 2, //类型1=订单收益2=提现到银行卡3=保证金缴纳4=保证金提现
  //       orderJson: {
  //         //订单收益数据
  //         orderServiceId: 190,
  //         localNo: "S3447665091759594", //订单号
  //         firstStatus: 7,
  //         secondStatus: 0,
  //         userId: 9,
  //         orderServiceWorkerId: 48,
  //         secondOrderServiceWorkerId: 0,
  //         orderServiceWorker: {
  //           orderServiceWorkerId: 48,
  //           status: 7,
  //           workerId: 7,
  //           address: "黑龙江省哈尔滨市南岗区顺益街2号", //地址
  //           orderServiceTitle: "欢 - 日常保洁", //工作内容
  //           createdAt: "2025-01-08 13:14:37",
  //           startServicedAt: "2025-01-11 15:30:00",
  //           endServicedAt: "2025-01-11 16:20:00",
  //           servicedAt: "2025-01-11 15:30-16:20", //服务时间
  //         },
  //         orderWorkerDistribution: {
  //           orderWorkerDistributionId: 27,
  //           workerDistributionPrice: "186.00", //总收益金额
  //           orderDistributionPrice: "186.00", //订单金额
  //           secondDistributionPrice: "0.00", //附加服务费相加
  //           urgentDistributionPrice: "0.00", //附加服务费相加
  //           subsidyDistributionPrice: "0.00", //附加服务费相加
  //           orderType: 1,
  //           status: 0,
  //         },
  //       },
  //       bankJson: {
  //         //提现银行信息
  //         userBankId: 1,
  //         workerId: 1,
  //         accountNo: "6214834565350791",
  //         bankMeta: {
  //           bankName: "招商银行", //提现银行名
  //           BankCode: "03080000",
  //           BankId: 5,
  //           type: "借记卡",
  //           cardname: "银联IC普卡",
  //           tel: "95555",
  //           Icon: "http://bkaear.market.alicloudapi.com/banklogo/2014121619271052743.gif",
  //         },
  //         name: "李炳林",
  //         bankPreMobile: "18724444521",
  //         idCardCode: "232321199401040913",
  //         updatedAt: "2025-01-08 13:57:25",
  //         deletedAt: null,
  //         createdAt: "2025-01-08 13:57:25",
  //       },
  //       status: 2, //状态0=待审核1=通过(银行处理中)2=到账3=失败
  //       reason: "", //失败原因
  //       bankSuccessAt: null, //到账时间
  //       createdAt: "2025-01-10 09:20:11", //申请时间
  //     },
  //   });
  // });
};

/**
 * 提现的银行卡
 * price 金额
 * safetyPassword 密码
 * userBankId 银行卡id
 */
export const withdraw = (
  params,
  config = {
    custom: {
      auth: true,
    },
  }
) => {
  return http.post({
    url: `/wallet/withdraw`,
    params,
    config,
  });
};
